<%@ page language="java" import="java.util.*" pageEncoding="utf-8"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<%@ taglib prefix="s" uri="/struts-tags" %>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
String jiedian = request.getParameter("jiedian");
String shenheren = request.getParameter("shenheren");
String pizhunren = "";
String ddyname = "";
if(null != request.getParameter("pizhunren") && !"".equals(request.getParameter("pizhunren"))){
	pizhunren = new String(request.getParameter("pizhunren").getBytes("iso8859-1"), "utf-8");
	ddyname = new String(request.getParameter("ddyname").getBytes("iso8859-1"), "utf-8");
}
String ddy = request.getParameter("ddy");
%>
<%@ taglib uri="/struts-tags" prefix="s"%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html xmlns="http://www.w3.org/1999/xhtml">
  <head>
  <base target="_self"/>
    <link rel="stylesheet" type="text/css" href="<%=path %>/web/style/layout.css" />
    <script type="text/javascript" src="<%=path %>/jqGrid/js/jquery-1.7.2.min.js"></script>
    <script type="text/javascript" src="<%=path %>/jslib/jquery.validate.min.js"></script>
    <script type='text/javascript' src="<%=request.getContextPath() %>/jslib/My97DatePicker/WdatePicker.js" defer="defer"></script>
    <script type='text/javascript' src="<%=request.getContextPath() %>/jslib/jquery.form.js"></script>
    <script type="text/javascript" src="<%=request.getContextPath() %>/jslib/additional-methods.js"></script>
    <link rel="stylesheet" type="text/css" href="<%=request.getContextPath() %>/jslib/jquery-easyui-1.4.1/themes/default/easyui.css">
	<link rel="stylesheet" type="text/css" href="<%=request.getContextPath() %>/jslib/jquery-easyui-1.4.1/themes/icon.css">
	<link rel="stylesheet" type="text/css" href="<%=request.getContextPath() %>/jslib/jquery-easyui-1.4.1/demo.css">
	<script type="text/javascript" src="<%=request.getContextPath() %>/jslib/jquery-easyui-1.4.1/jquery.easyui.min.js"></script>
    <c:if test="${requestScope.message!=null}">
		<script type="text/javascript">
 	 		     alert('<c:out value="${requestScope.message}"></c:out>');
 	 		     window.close();
 		</script>
	</c:if>
	
    <script type="text/javascript">
    $(document).ready(function(){
            $("#entry").click(function(){
                    if(!checking()){
                    	return false;
                    }
                    if("<%=jiedian%>" == "proc3"){
                    	var dagangshenheren = $("#dagangshenheren").val();
				 		var daganghuiqianren = $("#daganghuiqianren").val();
				 		var dagangpizhunren = $("#dagangpizhunren").val();
				        window.returnValue = '{"dagangshenheren":"'+dagangshenheren+'","daganghuiqianren":"'+daganghuiqianren+'","dagangpizhunren":"'+dagangpizhunren+'","state":"save"}';
                    }else if("<%=jiedian%>" == "proc13"){
                    	var baogaoshenheren = $("#baogaoshenheren").val();
				 		var baogaopizhunren = $("#baogaopizhunren").val();
				        window.returnValue = '{"baogaoshenheren":"'+baogaoshenheren+'","baogaopizhunren":"'+baogaopizhunren+'","state":"save"}';
                    }else{
                    	var bianzhirenyuan = $("#bianzhirenyuan").val();
				 		var pizhunrenyuan = $("#pizhunrenyuan").val();
				 		var jieshoufangdaibiao = $("#jieshoufangdaibiao").val();
				        window.returnValue = '{"bianzhirenyuan":"'+bianzhirenyuan+'","pizhunrenyuan":"'+pizhunrenyuan+'","jieshoufangdaibiao":"'+jieshoufangdaibiao+'","state":"save"}';
                    }
			        window.close();
	         });
	  		 $("#center").click(function(){
	  		 		window.returnValue = '{"state":"close"}';
			        window.close();
	         });
	});
	
   	function checking(){
   	    if("<%=jiedian%>" == "proc3"){
			var dagangshenherenname = $.trim($("#dagangshenherenname").val());
			var daganghuiqianrenname = $.trim($("#daganghuiqianrenname").val());
			var dagangpizhunrenname = $.trim($("#dagangpizhunrenname").val());
			
			if(dagangshenherenname ==null || dagangshenherenname == "" ){
				alert("审核人不能为空！");
				$("#dagangshenherenname").focus();
	    		return false;
			}
			if(daganghuiqianrenname ==null || daganghuiqianrenname == "" ){
				alert("会签人不能为空！");
				$("#daganghuiqianrenname").focus();
	    		return false;
			}
			if(dagangpizhunrenname ==null || dagangpizhunrenname == "" ){
				alert("批准人不能为空！");
				$("#dagangpizhunrenname").focus();
	    		return false;
			}
		}else if("<%=jiedian%>" == "proc13"){
			var baogaoshenherenname = $.trim($("#baogaoshenherenname").val());
			var baogaopizhunrenname = $.trim($("#baogaopizhunrenname").val());
			
			if(baogaoshenherenname ==null || baogaoshenherenname == "" ){
				alert("审核人不能为空！");
				$("#baogaoshenherenname").focus();
	    		return false;
			}
			if(baogaopizhunrenname ==null || baogaopizhunrenname == "" ){
				alert("批准人不能为空！");
				$("#baogaopizhunrenname").focus();
	    		return false;
			}
		}else{
			var bianzhirenyuanname = $.trim($("#bianzhirenyuanname").val());
			var pizhunrenyuanname = $.trim($("#pizhunrenyuanname").val());
			var jieshoufangdaibiaoname = $.trim($("#jieshoufangdaibiaoname").val());
			
			if(bianzhirenyuanname ==null || bianzhirenyuanname == "" ){
				alert("编制人员不能为空！");
				$("#bianzhirenyuanname").focus();
	    		return false;
			}
			if(pizhunrenyuanname ==null || pizhunrenyuanname == "" ){
				alert("批准人员不能为空！");
				$("#pizhunrenyuanname").focus();
	    		return false;
			}
			if(jieshoufangdaibiaoname ==null || jieshoufangdaibiaoname == "" ){
				alert("接收方代表不能为空！");
				$("#jieshoufangdaibiaoname").focus();
	    		return false;
			}
		}
		return true;
	}

	
	//选择人员
	function selectperson(id)
	{    var roleid = "";
	     if(id == "pizhunrenyuan"){
	     	roleid = 602;
	     }else if(id == "jieshoufangdaibiao"){
	     	roleid = 601;
	     }else if(id == "dagangshenheren"){
	     	roleid = 630;
	     }else if(id == "daganghuiqianren"){
	     	roleid = 631;
	     }else if(id == "dagangpizhunren"){
	     	roleid = 632;
	     }else if(id == "baogaoshenheren"){
	     	roleid = 605;
	     }else if(id == "baogaopizhunren"){
	     	roleid = 606;
	     }
		 var users = window.showModalDialog("<%=request.getContextPath() %>/resource/choose/choose_User.jsp?roleid="+roleid, window, "dialogWidth:635px;status:no;dialogHeight:400px");
    	if (users != null) {
			$("#"+id+"name").val(users.username);
		    $("#"+id).val(users.userid);
		   }
	}
	

   </script>
 	<style type="text/css">
 		body{
 			background:#ffffff; background-image:url(images/);
 		}
   		html{
		    overflow-x: hidden;
			overflow-y: hidden;
		}  	
		.formTableNew textarea{border: 1px solid #999;padding: 5px;width: 760px;-moz-border-radius: 3px;border-radius: 3px;margin-bottom: 5px;color: #666;background: url(../images/input_bg.gif) repeat-x top;}
   </style>
  </head>
  
  <body>
<form id="pageFrom" action="" enctype="multipart/form-data" method="post">
        <input type="hidden" id="flag" name="flag" />
        <!-- 发起节点选择人员 -->
        <%if("proc3".equals(jiedian)){ %>
        <table width="100%" border="0" align="center" cellpadding="5" cellspacing="5" class="formTableNew">
  			<tr>
  			  <td align="right">审核人：</td>
  			  <td align="left">
  			    <input type="hidden" id="dagangshenheren" name="dagangshenheren" value="" />
  			    <input  type="text"  id="dagangshenherenname" maxlength="50" name="dagangshenherenname" style="border: 1px solid #999;padding: 5px;width: 250px;height:25px;"  value="" />
  			  	<img src="<%=request.getContextPath() %>/images/xh.png" align="absmiddle"></img>
  			  	<img src="<%=request.getContextPath() %>/web/images/form_icon_1.gif" style="cursor:hand; vertical-align: middle;" onclick="selectperson('dagangshenheren')" />
  			  </td>
  			</tr>
  			<tr>
  			  <td align="right">会签人：</td>
  			  <td align="left">
  			    <input type="hidden" id="daganghuiqianren" name="daganghuiqianren" value="" />
  			    <input  type="text"  id="daganghuiqianrenname" maxlength="50" name="daganghuiqianrenname" style="border: 1px solid #999;padding: 5px;width: 250px;height:25px;"  value="" />
  			  	<img src="<%=request.getContextPath() %>/images/xh.png" align="absmiddle"></img>
  			  	<img src="<%=request.getContextPath() %>/web/images/form_icon_1.gif" style="cursor:hand; vertical-align: middle;" onclick="selectperson('daganghuiqianren')" />
  			  </td>
  			</tr>
  			<tr>
  			  <td align="right">批准人：</td>
  			  <td align="left">
  			    <input type="hidden" id="dagangpizhunren" name="dagangpizhunren" value="" />
  			    <input  type="text"  id="dagangpizhunrenname" maxlength="50" name="dagangpizhunrenname" style="border: 1px solid #999;padding: 5px;width: 250px;height:25px;"  value="" />
  			  	<img src="<%=request.getContextPath() %>/images/xh.png" align="absmiddle"></img>
  			  	<img src="<%=request.getContextPath() %>/web/images/form_icon_1.gif" style="cursor:hand; vertical-align: middle;" onclick="selectperson('dagangpizhunren')" />
  			  </td>
  			</tr>
		</table>
        <%}else if("proc13".equals(jiedian)){%>
        <table width="100%" border="0" align="center" cellpadding="5" cellspacing="5" class="formTableNew">
  			<tr>
  			  <td align="right">审核人：</td>
  			  <td align="left">
  			    <input type="hidden" id="baogaoshenheren" name="baogaoshenheren" value="" />
  			    <input  type="text"  id="baogaoshenherenname" maxlength="50" name="baogaoshenherenname" style="border: 1px solid #999;padding: 5px;width: 250px;height:25px;"  value="" />
  			  	<img src="<%=request.getContextPath() %>/images/xh.png" align="absmiddle"></img>
  			  	<img src="<%=request.getContextPath() %>/web/images/form_icon_1.gif" style="cursor:hand; vertical-align: middle;" onclick="selectperson('baogaoshenheren')" />
  			  </td>
  			</tr>
  			<tr>
  			  <td align="right">批准人：</td>
  			  <td align="left">
  			    <input type="hidden" id="baogaopizhunren" name="baogaopizhunren" value="" />
  			    <input  type="text"  id="baogaopizhunrenname" maxlength="50" name="baogaopizhunrenname" style="border: 1px solid #999;padding: 5px;width: 250px;height:25px;"  value="" />
  			  	<img src="<%=request.getContextPath() %>/images/xh.png" align="absmiddle"></img>
  			  	<img src="<%=request.getContextPath() %>/web/images/form_icon_1.gif" style="cursor:hand; vertical-align: middle;" onclick="selectperson('baogaopizhunren')" />
  			  </td>
  			</tr>
		</table>
        <% }else{ %>
        <table width="100%" border="0" align="center" cellpadding="5" cellspacing="5" class="formTableNew">
  			<tr>
  			  <td align="right">编制人员：</td>
  			  <td align="left">
  			    <input type="hidden" id="bianzhirenyuan" name="bianzhirenyuan" value="<%=request.getSession().getAttribute("TDM_USER_ID").toString() %>" />
  			    <input  type="text" disabled="disabled" id="bianzhirenyuanname" maxlength="50" name="bianzhirenyuanname"   value="<%=request.getSession().getAttribute("username").toString() %>" />
  			  </td>
  			</tr>
  			<tr>
  			  <td align="right">批准人员：</td>
  			  <td align="left">
  			    <input type="hidden" id="pizhunrenyuan" name="pizhunrenyuan" value="" />
  			    <input  type="text"  id="pizhunrenyuanname" maxlength="50" name="pizhunrenyuanname"   value="" />
  			  	<img src="<%=request.getContextPath() %>/images/xh.png" align="absmiddle"></img>
  			  	<img src="<%=request.getContextPath() %>/web/images/form_icon_1.gif" style="cursor:hand; vertical-align: middle;" onclick="selectperson('pizhunrenyuan')" />
  			  </td>
  			</tr>
  			<tr>
  			  <td align="right">接收方代表：</td>
  			  <td align="left">
  			    <input type="hidden" id="jieshoufangdaibiao" name="jieshoufangdaibiao" value="" />
  			    <input  type="text"  id="jieshoufangdaibiaoname" maxlength="50" name="jieshoufangdaibiaoname"   value="" />
  			    <img src="<%=request.getContextPath() %>/images/xh.png" align="absmiddle"></img>
  			    <img src="<%=request.getContextPath() %>/web/images/form_icon_1.gif" style="cursor:hand; vertical-align: middle;" onclick="selectperson('jieshoufangdaibiao')" />
  			  	
  			  </td>
  			</tr>
		</table>
        <%} %>
  		<table width="100%" border="0" align="center" class="formTableNew">
		  <tr>
			<td align="center">
		    	<input id="entry" type="button" value="提 交" class="form_bt_orange" />
		    	<input type="button" id="center" value="取 消" class="form_bt_grey" />
		    </td>
		  </tr>
		</table>
	<!--表单结束-->
	</form>
  </body>
</html>
